package com.setmaat.simcardinfo;

import android.app.Activity;
import android.content.Context;
import android.os.Bundle;
import android.widget.TextView;
import android.telephony.TelephonyManager;


public class SimcardInfo extends Activity {
    /** Called when the activity is first created. */

    @Override
    
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
      
        
        setContentView(R.layout.main);
    
            TelephonyManager tm = (TelephonyManager) this.getSystemService(Context.TELEPHONY_SERVICE);        
           
            //info simcard

            //numero di tel
            CharSequence num = tm.getLine1Number();
            
           //CharSequence stringaRecuperata = getString(telNumber);
            TextView numView = (TextView)findViewById(R.id.numero);
           	numView.setText(num);

            
            //seriale sim
           	CharSequence sim = tm.getSimSerialNumber();
           	TextView simView = (TextView)findViewById(R.id.seriale);
          	simView.setText(sim);
           	
            // operatore
           	CharSequence ope = tm.getNetworkOperatorName();    
           	TextView opeView = (TextView)findViewById(R.id.operatore);
           	opeView.setText(ope);
            
            //Tipologia di Rete

            TextView reteView = (TextView)findViewById(R.id.rete);
            
           	int rete= tm.getNetworkType();
            if (rete == 0){
            	CharSequence sconos = "Sconosciuto"; 
            	 reteView.setText(sconos);
            }
            if(rete == 1){
            	CharSequence gprs = "gprs";      
            	reteView.setText(gprs);
            }
            if(rete == 2){
            	CharSequence edge = "edge";
            	reteView.setText(edge);
            }
            if(rete == 3){
            	CharSequence umts = "umts";
            	reteView.setText(umts);
            }
            
            // imei
            CharSequence imei = tm.getDeviceId();    
            TextView imeiView = (TextView)findViewById(R.id.imei);
            imeiView.setText(imei);
            
            /*      
            str += "NetworkCountryIso = " + tm.getNetworkCountryIso() + "\n";    
            str += "NetworkOperator = " + tm.getNetworkOperator() + "\n";
            str += "DeviceSoftwareVersion = " + tm.getDeviceSoftwareVersion() + "\n";
            str += "PhoneType = " + tm.getPhoneType() + "\n";  
            str += "SimCountryIso = " + tm.getSimCountryIso() + "\n";    
            str += "SimOperator = " + tm.getSimOperator() + "\n";    
            str += "SimOperatorName = " + tm.getSimOperatorName() + "\n";  
            str += "SimState = " + tm.getSimState() + "\n";    
            str += "SubscriberId(IMSI) = " + tm.getSubscriberId() + "\n";    
            str += "VoiceMailNumber = " + tm.getVoiceMailNumber() + "\n";                 
          String iccid = getSimSerialNumber();
        Context.getSystemService(Context.TELEPHONY_SERVICE);
        Sring ICCID = TelephonyProperties.PROPERTY_ICCID;
        String myIMEI = android.os.SystemProperties.get(android.telephony.TelephonyProperties.PROPERTY_IMEI);
      
            */
            
    
  
      //  TextView sys = new TextView(this);

        
//        sys.setText(str);  

  //      setContentView(sys); 

        
        /*    
            TextView tv = new TextView(this);
            tv.setText("Hello, Android");
            setContentView(tv);  
            
           */ 
 
            


        
    }
    
    

}